"use strict";
/**
 * 这个Demo 可以更快的理解 装饰器的作用
 *  这个思路可以广泛的利用于后端的服务器中
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
{
    /**
     * 可以通过装饰器轻松实现一个好用的返回方法
     *  当然这个例子使用类的继承也能实现  但是使用装饰器也是一样轻松 甚至更新颖
     */
    const messageDecorator = (target) => {
        target.prototype.message = (content) => {
            console.log({ result: content, code: 200 });
        };
    };
    let LoginController = class LoginController {
        login() {
            console.log("正在处理登录...");
            this.message("登录成功");
        }
    };
    LoginController = __decorate([
        messageDecorator
    ], LoginController);
    new LoginController().login();
    let ArticelController = class ArticelController {
        send() {
            console.log("正在发送中...");
            this.message("发送成功");
        }
    };
    ArticelController = __decorate([
        messageDecorator
    ], ArticelController);
    new ArticelController().send();
}
